<?php
defined('IN_SITE') or exit('Access Denied');
if($_userid <> 1) showmessage('您不是管理员！');

	if($dosubmit){
		 
		//dump($memberdata);exit();
		$userid = $member->register($memberdata);
		
		// debug
		//echo $member->msg();
		
		$companyid = $db->update(DB_PRE.'member_company',$companydata," userid = $userid ");
		if($companyid) showmessage('添加成功',$forward);
	}
?>


<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title><?php echo $head['title']?></title>
<base href="<?php echo SITE_URL?>" />
<link href="favicon.ico" rel="shortcut icon" />
<link href="../skin/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="misc/config.js"></script>
<script language="JavaScript" src="misc/jquery.min.js"></script>
<script language="JavaScript" src="misc/common.js"></script>
<script language="JavaScript" src="misc/validator.js"></script>
<link href="{SKIN_PATH}modal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	*{ font-size:12px; line-height:22px;}
</style>
</head>
<body>

<form action="" method="post">
<table width="684" height="124" border="0">
  <tr>
    <td width="86" align="right">*用户名：</td>
    <td width="582"><input type="text" name="memberdata[username]" id="reg_username" value="" size="40" maxlength="20"  require="false" datatype="limit|ajax" url="<?=url("?module=member&action=checkuser")?>" min="3" max="20" msg="用户名不得少于3个字符超过20个字符|" /></td>
  </tr>
  <tr>
    <td align="right">企业域名：</td>
    <td><input id="sitedomain" name="companydata[sitedomain]" require="false" datatype="limit" min="3" max="255" msg="企业域名不得少于3个字符或超过255个字符！"  type="text" size="40" maxlength="16" />.{SECONDDOMAIN_NAME}</td>
  </tr>
  <tr>
    <td align="right">*密　码：</td>
    <td><input id="password" name="memberdata[password]" require="true" datatype="limit" min="6" max="16" msg="密码不得少于6个字符或超过16个字符！"  type="text" size="40" maxlength="16" /></td>
  </tr>
  <tr>
    <td align="right">*Email地址：</td>
    <td><input name="memberdata[email]" type="text"  style="ime-mode:disabled" require="true" datatype="email" msg="邮件格式不正确|" id="email" size="30" /></td>
  </tr>
  <tr>
    <td align="right">*企业名称：</td>
    <td><input name="companydata[companyname]" require="true" datatype="limit" min="3" max="255" msg="企业名称不得少于3个字符或超过255个字符！"  type="text" size="40" maxlength="16" /></td>
  </tr>
  <tr>
    <td align="right">联系人：</td>
    <td><input name="companydata[linkman]" type="text" size="40" /></td>
  </tr>
  <tr>
    <td align="right">Email：</td>
    <td><input name="companydata[email]" type="text" size="40" /></td>
  </tr>
  <tr>
    <td align="right">联系电话：</td>
    <td><input name="companydata[telephone]" type="text" size="40" /></td>
  </tr>
  <tr>
    <td align="right">经营地址：</td>
    <td><input name="companydata[address]" type="text" size="40" /></td>
  </tr>
  <tr>
    <td align="right">主营产品或服务：</td>
    <td><textarea name="companydata[products]" cols="50" rows="5"></textarea></td>
  </tr>
  <tr>
    <td align="right">*企业介绍：</td>
    <td><textarea name="companydata[introduce]" cols="50" rows="20" require="true" datatype="limit" min="3" max="10000" msg="企业介绍不得少于3个字符或超过10000个字符！"></textarea></td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td><label>
      <input type="submit" name="dosubmit" id="button" value="提交">
      <input name="memberdata[modelid]" type="hidden" value="11">
      <input name="companydata[status]" type="hidden" value="1">
    </label></td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
<script language="javascript" type="text/javascript">
$().ready(function() { 
	  $('#reg_username').blur(function(){ 
	  
	  	  // 自动创建密码
	  	  if($(this).val().length < 6){
		  	$('#password').val('123456');
		  }
		  else{
	  	  	$('#password').val($(this).val());
		  }
		  
		  // 自动创建用户名
		  if($(this).val().length <= 0){
		  	$(this).val('<?php echo 'temp'.time();?>');
		  }
		  
	  	  $('#email').val($(this).val()+"@<?=$_SERVER['SERVER_NAME']?>");
	  })
	  
	  //
	  $('form').checkForm(1);
	});
</script>
</body>
</html>